// https://leetcode.cn/problems/sum-of-left-leaves/
// Created by ade on 2022/8/4.
//
#include<iostream>
#include<string>
#include<vector>

using namespace std;

class Solution {
public:
    int sum = 0;

    int sumOfLeftLeaves(TreeNode *root) {
        dfs(root);
        return sum;
    }

    void dfs(TreeNode *root) {
        if (!root) return;
        if (root->left && !root->left->left && !root->left->right) {
            sum += root->left->val;
        }
        dfs(root->left);
        dfs(root->right);
    }
};

int main() {

}